import { ecs } from 'db://app-game/libs/ecs/ECS';
import { TableLevel } from '../../../../table/TableLevel';
import { Vec3, Node } from 'cc';

/** 关卡基础数据 */
@ecs.register('LevelModel')
export class LevelModelComp extends ecs.Comp {
  private table: TableLevel = new TableLevel();
  private _id: number = -1;
  /** 关卡id */
  get id(): number {
    return this._id;
  }
  set id(value: number) {
    this._id = value;
    this.table.init(value);
  }

  /** 地图Id */
  get mapId(): number {
    return this.table.mapId;
  }

  /** 角色初始位置 */
  get roleInitPosition(): Vec3 {
    return new Vec3(this.table.roleInitPosition.x, this.table.roleInitPosition.y, 0);
  }

  /** 关卡UI节点 */
  public uiNode: Node = null!;

  reset(entity: ecs.Entity): void {}
}
